﻿using System.Collections.Generic;

public class WallWaveManager
{
    private WaveModel wave = new WaveModelNull();
    private WaveFactory waveFactory;

    public WallWaveManager(WaveFactory _waveFactory)
    {
        waveFactory = _waveFactory;
    }

    public void update(int currentBlockIndex)
    {
        if (isFirstBlock(currentBlockIndex))
            setUpNextWave();
    }

    public float popNextWave()
    {
        if (!wave.hasWave())
            return 0;

        float waveHeight = wave.getWaveHeight();

        return waveHeight;
    }

    private bool isFirstBlock(int currentBlock)
    {
        return currentBlock == 0;
    }

    private void setUpNextWave()
    {
        if (wave.hasWave())
            return;

        wave = waveFactory.createWave();
    }
}